package com.file.manage.infrastructure.base.entiry;


import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author H41
 * @Type BaseTable.java
 * @date 2025/5/30 23:22
 * @Desc 数据库实体基础类
 */
@Setter
@Getter
@Accessors(chain = true)
@Schema(title = "数据库实体基础类")
public class BaseEntity<T extends Model<?>> extends Model<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.INPUT)
    @Schema(title = "id")
    private String id;
    /**
     * 是否删除
     */
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @Schema(title = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(title = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(title = "修改时间")
    private Date updatedTime;

    @TableField(fill = FieldFill.UPDATE)
    @Schema(title = "修改人")
    private String updatedBy;
}

